Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

fix engine crash in shutdown phase #14382

Merged
merged 3 commits into from
Mar 11, 2019
Merged

Conversation

arcadiaphy
Copy link
Member

Description

@DickJC123 has reported the engine crash in #14329 which is related to my early PR on ASAN fix (#14223), this PR tries to fix the crash and restores the CI bypass in #14338.

After reproducing the crash in docker, I found it happens when trying to destruct resources using Storage singleton in engine shutdown phase. So I added shared_ptr in threaded engine to force Storage to destruct after engine cleanup.

Thus, the crash has two properties:

  1. It doesn't happen all the time and is hard to reproduce because the destruction order of static variable is almost undefined in c++, which causes many similar bugs, uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument #309 for example. For the time being, we can only add patches of shared_ptr when crash happens.
  2. It happens in test_convolution_multiple_streams because sub-process is used to run tests, leading to 6 engine shutdown phases in one single test.

In order to verify the fix, 100 times of test_convolution_multiple_streams is executed without crash.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

Copy link
Member

@wkcn wkcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix!
LGTM

@wkcn wkcn merged commit 4f5cba5 into apache:master Mar 11, 2019
@wkcn
Copy link
Member

wkcn commented Mar 11, 2019

The PR has been merged.
Thanks for your contribution!

@arcadiaphy arcadiaphy deleted the pr_mem_crash branch March 11, 2019 04:13
vdantu pushed a commit to vdantu/incubator-mxnet that referenced this pull request Mar 31, 2019
* fix engine crash in shutdown phase

* fix lint

* Revert "Bypass ThreadedEngine in test_operator_gpu.py:test_convolution_multiple_streams. (apache#14338)"

This reverts commit d6eafca.
nswamy pushed a commit that referenced this pull request Apr 5, 2019
* fix engine crash in shutdown phase

* fix lint

* Revert "Bypass ThreadedEngine in test_operator_gpu.py:test_convolution_multiple_streams. (#14338)"

This reverts commit d6eafca.
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
* fix engine crash in shutdown phase

* fix lint

* Revert "Bypass ThreadedEngine in test_operator_gpu.py:test_convolution_multiple_streams. (apache#14338)"

This reverts commit d6eafca.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants